﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Campaign_Manager
{
    public partial class frmMonster : Form
    {
        private Databases Data;
        public frmMonster()
        {
            InitializeComponent();
            Data = new Databases();
        }

        private void cmbCR_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbMonster.Items.Clear();
            cmbMonster.Items.AddRange(Data.Monsters((string)cmbCR.SelectedItem));
        }

        private void cmbMonster_SelectedIndexChanged(object sender, EventArgs e)
        {
            webMonster.Navigate("about:blank");
            if (webMonster.Document != null)
            {
                webMonster.Document.Write(string.Empty);
            }
            string docText = Data.MonsterInfo((string)cmbMonster.SelectedItem);
            webMonster.DocumentText = Data.MonsterInfo((string)cmbMonster.SelectedItem);
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }

        private void frmMonster_Resize(object sender, EventArgs e)
        {
            webMonster.Width = this.Width - 40;
            webMonster.Height = this.Height - 108;
            btnAdd.Left = this.Width - 184;
            btnAdd.Top = this.Height - 63;
            btnCancel.Top = btnAdd.Top;
            btnCancel.Left = btnAdd.Left + 81;
        }
    }
}
